/*
 * XML Type:  sql-result-set-mapping
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.SqlResultSetMapping
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML sql-result-set-mapping(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class SqlResultSetMappingImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.SqlResultSetMapping
{

    /**  */
	private static final long serialVersionUID = 5549275606694172519L;


	public SqlResultSetMappingImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName ENTITYRESULT$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "entity-result");
    private static final javax.xml.namespace.QName COLUMNRESULT$2 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "column-result");
    private static final javax.xml.namespace.QName NAME$4 =
        new javax.xml.namespace.QName("", "name");


    /**
     * Gets a List of "entity-result" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult> getEntityResultList()
    {
        final class EntityResultList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult get(int i)
                { return SqlResultSetMappingImpl.this.getEntityResultArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult old = SqlResultSetMappingImpl.this.getEntityResultArray(i);
                SqlResultSetMappingImpl.this.setEntityResultArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult o)
                { SqlResultSetMappingImpl.this.insertNewEntityResult(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult old = SqlResultSetMappingImpl.this.getEntityResultArray(i);
                SqlResultSetMappingImpl.this.removeEntityResult(i);
                return old;
            }

            @Override
			public int size()
                { return SqlResultSetMappingImpl.this.sizeOfEntityResultArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new EntityResultList();
        }
    }

    /**
     * Gets array of all "entity-result" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult[] getEntityResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(ENTITYRESULT$0, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "entity-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult getEntityResultArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult)get_store().find_element_user(ENTITYRESULT$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "entity-result" element
     */
    public int sizeOfEntityResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(ENTITYRESULT$0);
        }
    }

    /**
     * Sets array of all "entity-result" element
     */
    public void setEntityResultArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult[] entityResultArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(entityResultArray, ENTITYRESULT$0);
        }
    }

    /**
     * Sets ith "entity-result" element
     */
    public void setEntityResultArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult entityResult)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult)get_store().find_element_user(ENTITYRESULT$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(entityResult);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "entity-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult insertNewEntityResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult)get_store().insert_element_user(ENTITYRESULT$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "entity-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult addNewEntityResult()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult)get_store().add_element_user(ENTITYRESULT$0);
            return target;
        }
    }

    /**
     * Removes the ith "entity-result" element
     */
    public void removeEntityResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(ENTITYRESULT$0, i);
        }
    }

    /**
     * Gets a List of "column-result" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult> getColumnResultList()
    {
        final class ColumnResultList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult get(int i)
                { return SqlResultSetMappingImpl.this.getColumnResultArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult old = SqlResultSetMappingImpl.this.getColumnResultArray(i);
                SqlResultSetMappingImpl.this.setColumnResultArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult o)
                { SqlResultSetMappingImpl.this.insertNewColumnResult(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult old = SqlResultSetMappingImpl.this.getColumnResultArray(i);
                SqlResultSetMappingImpl.this.removeColumnResult(i);
                return old;
            }

            @Override
			public int size()
                { return SqlResultSetMappingImpl.this.sizeOfColumnResultArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new ColumnResultList();
        }
    }

    /**
     * Gets array of all "column-result" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult[] getColumnResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(COLUMNRESULT$2, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "column-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult getColumnResultArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult)get_store().find_element_user(COLUMNRESULT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "column-result" element
     */
    public int sizeOfColumnResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(COLUMNRESULT$2);
        }
    }

    /**
     * Sets array of all "column-result" element
     */
    public void setColumnResultArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult[] columnResultArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(columnResultArray, COLUMNRESULT$2);
        }
    }

    /**
     * Sets ith "column-result" element
     */
    public void setColumnResultArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult columnResult)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult)get_store().find_element_user(COLUMNRESULT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(columnResult);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "column-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult insertNewColumnResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult)get_store().insert_element_user(COLUMNRESULT$2, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "column-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult addNewColumnResult()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.ColumnResult)get_store().add_element_user(COLUMNRESULT$2);
            return target;
        }
    }

    /**
     * Removes the ith "column-result" element
     */
    public void removeColumnResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(COLUMNRESULT$2, i);
        }
    }

    /**
     * Gets the "name" attribute
     */
    public java.lang.String getName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "name" attribute
     */
    public org.apache.xmlbeans.XmlString xgetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$4);
            return target;
        }
    }

    /**
     * Sets the "name" attribute
     */
    public void setName(java.lang.String name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(NAME$4);
            }
            target.setStringValue(name);
        }
    }

    /**
     * Sets (as xml) the "name" attribute
     */
    public void xsetName(org.apache.xmlbeans.XmlString name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(NAME$4);
            }
            target.set(name);
        }
    }
}
